Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: naming connect procedure #3157

Merged
merged 12 commits into from
Oct 29, 2024
Merged

chore: naming connect procedure #3157

merged 12 commits into from
Oct 29, 2024

Conversation

gabrielmer
Copy link
Contributor

@gabrielmer gabrielmer commented Oct 29, 2024

Description

Looking deeper at the code, I noticed that the connectRelay procedure uses the nim-libp2p connect procedure that connects to a node without setting a protocol. connectRelay was a misnomer and it's more correct to call itconnectPeer

Changes

  • renaming connectRelay to connectPeer
  • removing checks for Relay being configured before calling connectPeer
  • in connectPeer, add peer if it's not found in the peer store instead of looking specifically for Waku Relay's codec

Copy link

github-actions bot commented Oct 29, 2024

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:3157

Built from 146097d

Comment on lines -405 to -416
if not conf.relay:
return err("waku relay (--relay=true) should be set when configuring staticnodes")
try:
await connectToNodes(node, conf.staticnodes, "static")
except CatchableError:
return err("failed to connect to static nodes: " & getCurrentExceptionMsg())

if dynamicBootstrapNodes.len > 0:
if not conf.relay:
return err(
"waku relay (--relay=true) should be set when configuring dynamicBootstrapNodes"
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need these conditions that I added. When I added them I thought that connectToNodes, which called connectRelay, were only related to Relay protocol but the function name was a misnomer

@gabrielmer gabrielmer changed the title chore: refactor connections chore: naming connect procedure Oct 29, 2024
@gabrielmer gabrielmer marked this pull request as ready for review October 29, 2024 15:05
@Ivansete-status
Copy link
Collaborator

Thanks for that! Nevertheless, I think is interesting having a more descriptive proc name because connect is too generic and it difficult the implementation lookup.
I'm more keen on longer descriptive proc name than shorter/generic proc names such as send, put, etc :)

@gabrielmer
Copy link
Contributor Author

Thanks for that! Nevertheless, I think is interesting having a more descriptive proc name because connect is too generic and it difficult the implementation lookup. I'm more keen on longer descriptive proc name than shorter/generic proc names such as send, put, etc :)

Makes sense! I updated it to connectPeer instead :)

Thank you!

Copy link
Collaborator

@Ivansete-status Ivansete-status left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for it! 💯

@gabrielmer gabrielmer merged commit b3656d6 into master Oct 29, 2024
12 of 15 checks passed
@gabrielmer gabrielmer deleted the chore-refactor-connections branch October 29, 2024 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants